<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>GEN28</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="ScoregensTop.html" title="Score Statements and GEN Routines" />
    <link rel="prev" href="GEN27.html" title="GEN27" />
    <link rel="next" href="GEN30.html" title="GEN30" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN28</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN27.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN30.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="GEN28"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN28" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN28</span>
        </h2>
        <p>GEN28 — 
      Reads a text file which contains a time-tagged trajectory.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp215289312"></a>
        <h2>Description</h2>
        <p>
      This function generator reads a text file which contains sets of three values representing the xy coordinates and a time-tag for when the signal should be placed at that location, allowing the user to define a time-tagged trajectory. The file format is in the form:
      </p>
        <div class="literallayout">
          <p><br />
time1    X1      Y1<br />
time2    X2      Y2<br />
time3    X3      Y3<br />
      </p>
        </div>
        <p>
    </p>
        <p>
      The configuration of the xy coordinates in space places the signal in the following way:

      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>a1 is -1, 1</p>
            </li>
            <li class="listitem">
              <p>a2 is 1, 1</p>
            </li>
            <li class="listitem">
              <p>a3 is -1, -1</p>
            </li>
            <li class="listitem">
              <p>a4 is 1, -1</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      This assumes a loudspeaker set up as a1 is left front, a2 is right front, a3 is left back, a4 is right back. Values greater than 1 will result in sounds being attenuated as if in the distance. <span class="emphasis"><em>GEN28</em></span> creates values to 10 milliseconds of resolution.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp215365296"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 28 ifilcod</pre>
      </div>
      <div class="refsect1">
        <a id="idp215367280"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be 0. <span class="emphasis"><em>GEN28</em></span> takes 0 as the size and automatically allocates memory.
    </p>
        <p>
      <span class="emphasis"><em>ifilcod</em></span> -- character-string denoting the source file name. A character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought in the current directory.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp215370496"></a>
        <h2>Examples</h2>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting"><span class="stamnt">f</span>1 0 0 28 "move"</pre>
        </div>
        <p>
    </p>
        <p>
      The file "move" should look like:

      </p>
        <div class="literallayout">
          <p><br />
0       -1       1<br />
1        1       1<br />
2        4       4<br />
2.1     -4      -4<br />
3        10     -10<br />
5       -40      0<br />
      </p>
        </div>
        <p>

      Since <span class="emphasis"><em>GEN28</em></span> creates values to 10 milliseconds of resolution, there will be 500 values created by interpolating X1 to X2 to X3 and so on, and Y1 to Y2 to Y3 and so on, over the appropriate number of values that are stored in the function table. The sound will begin in the left front, over 1 second it will move to the right front, over another second it move further into the distance but still in the right front, then in just 1/10th of a second it moves to the left rear, a bit distant. Finally over the last .9 seconds the sound will move to the right rear, moderately distant, and it comes to rest between the two left channels (due west!), quite distant.
    </p>
        <p>
      Here is an example of the GEN28 routine. It uses the file <a class="ulink" href="examples/gen28.csd" target="_top"><em class="citetitle">gen28.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp215377056"></a>
          <p class="title">
            <strong>Example 1116. Example of the gen28 opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac   <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o gen28.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100 
<span class="ohdr">ksmps</span> <span class="op">=</span> 32 
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1 
<span class="ohdr">nchnls</span> <span class="op">=</span> 4
  
ga1	<span class="opc">init</span>	0
ga2	<span class="opc">init</span>	0
ga3	<span class="opc">init</span>	0
ga4	<span class="opc">init</span>	0

<span class="oblock">instr</span> 1	<span class="comment">;uses GEN28 file "move", as found in /manual/examples</span>

kx    <span class="opc">init</span> 0
ky    <span class="opc">init</span> 0
ktime <span class="opc">line</span>  0, 5, 5				<span class="comment">;same time as in table 1 (="move")</span>
asig  <span class="opc">diskin2</span> "beats.wav", 1, 0, 1		<span class="comment">;sound source is looped</span>
a1, a2, a3, a4 <span class="opc">space</span> asig, 1, ktime, .1, kx, ky	<span class="comment">;use table 1 = GEN28</span>
ar1, ar2, ar3, ar4 <span class="opc">spsend</span>			<span class="comment">;send to reverb</span>

ga1  <span class="op">=</span> ga1<span class="op">+</span>ar1
ga2  <span class="op">=</span> ga2<span class="op">+</span>ar2
ga3  <span class="op">=</span> ga3<span class="op">+</span>ar3
ga4  <span class="op">=</span> ga4<span class="op">+</span>ar4
     <span class="opc">outq</span> a1, a2, a3, a4

<span class="oblock">endin</span>

<span class="oblock">instr</span> 99 <span class="comment">; reverb instrument</span>

a1 <span class="opc">reverb2</span> ga1, 2.5, .5
a2 <span class="opc">reverb2</span> ga2, 2.5, .5
a3 <span class="opc">reverb2</span> ga3, 2.5, .5
a4 <span class="opc">reverb2</span> ga4, 2.5, .5
   <span class="opc">outq</span>	a1, a2, a3, a4

ga1<span class="op">=</span>0	
ga2<span class="op">=</span>0
ga3<span class="op">=</span>0
ga4<span class="op">=</span>0

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>1 0 0 28 "move"

<span class="stamnt">i</span>1 0 5		<span class="comment">;same time as ktime</span>
<span class="stamnt">i</span> 99 0 10	<span class="comment">;keep reverb active</span>
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp215381344"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Karpen</td>
          </tr>
          <tr>
            <td>Seattle, Wash</td>
          </tr>
          <tr>
            <td>1998</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.48</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN27.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ScoregensTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="GEN30.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN27 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN30</td>
        </tr>
      </table>
    </div>
  </body>
</html>
